Facilitating client server interaction

ABSTRACT

The apparatus includes a base client module and a server module. The base client module receives requests from a client application on a client computer. The base client module calls a resource of a web application. A server module transparently interacts with the logic of the web application to obtain the requested data and sends it back to the base client in a format handled by the base client. The base client can then reformat the data to a client application requested format before passing the data to the client application. This method allows a client application programmer to obtain easily usable data from a web application by using the base client.

CROSS-REFERENCE TO RELATED APPLICATIONS

Cross-reference is made to a co-pending application by Luke Macken andToshio Kuatomi for “Method and System for Facilitating Client ServerInteraction” filed on the same date as the present application andcommonly owned. The cross-referenced application is incorporated hereinby reference.

TECHNICAL FIELD

Embodiments of the present invention relate to a method and system forfacilitating client server communication. Specifically, the embodimentsof the present invention relate to a method and system for enablingclient applications to obtain data from web applications in a convenientformat other than a standard web page format.

BACKGROUND

Web applications offer a diversity of functionality and data that isaccessible through a standard web browser. The functionality and dataare accessible through making hyper-text transfer protocol (HTTP)requests to the web applications or associated web servers. The webapplications process these requests and return data in the form ofhyper-text markup language (HTML) and extensible hyper-text markuplanguage (XHTML) documents.

A programmer of a client application that does not want to merelydisplay the returned data as a web browser would, has few desirableoptions to obtain the data in usable format. The programmer must codethe client application to make queries specific to a particular webapplication. The programmer must also code the client application toparse the returned data to obtain the desired data and then reformat thedata into a data structure that the client application can utilize. Thiscoding can be time consuming and is not easily reusable as extensiveadditional coding has to be done to interact with each web application.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is illustrated by way of example, and not by wayof limitation, in the figures of the accompanying drawings in which likereferences indicate similar elements. It should be noted that differentreferences to “an” or “one” embodiment in this disclosure are notnecessarily to the same embodiment, and such references mean at leastone.

FIG. 1 is a diagram of one embodiment of a system for facilitatingclient server communication.

FIG. 2 is a flowchart of one embodiment of a process for initializing abase client.

FIG. 3 is a diagram of one embodiment of a process for handling clientrequests by the base client.

FIG. 4 is a diagram of one embodiment of a computer system for providingthe base client.

DETAILED DESCRIPTION

Described herein is a method and system for facilitating communicationbetween a client and a server. The apparatus includes a base clientmodule and a server module. The base client module receives a requestfor data from a client application on a client computer. The base clientmodule then calls a method of the server module corresponding to therequest. The server module determines the type of the request beingreceived as a request for non-web page format data. The server moduleinteracts with the logic of the web application to obtain the requesteddata and sends it back to the base client in a format handled by thebase client. The base client can then reformat the data to a clientapplication requested format before passing the data to the clientapplication. This method and system allows a client applicationprogrammer to obtain easily usable data from a web application by usingthe base client. The web application programmer supports this system inthe form of the server module by exposing the functionality of the webapplication for non-web page based requests. The server modulefunctionality can be integrated with the web application to achieve thisgoal. The web application programmer can also provide a sub-class of thebase client that provides additional or improved functionality betweenthe web application and the base client.

FIG. 1 is a diagram of one embodiment of a system for facilitatingclient server communication. The system includes a set of clientcomputers 101 that communicate over a network 111 with a set of remoteservers 113A,B. A ‘set,’ as used herein, refers to any whole number ofitems, including one item. The client computer system 101 can be anytype of computing device including a desktop computer, laptop computer,handheld computer, console device, wireless device, or similar computingdevice. The servers 103A,B can be any type of computing device capableof executing a web application. The servers 103A,B can be desktopcomputers, laptop computers, dedicated servers, mainframes, consoledevices, wireless devices or similar computing devices. The network 111can be any type of network including a local area network (LAN), a widearea network (WAN), such as the Internet, or any other type of network.The network 111 can be provided over any type or combination of mediumsincluding a wired, optical, wireless or similar network architectures.

A client computer 101 includes a set of client applications 105A,B and aset of base clients 107A,B. A client application 105 A,B can be any typeof application including a business application, scientific application,game application or other type of application. The client application105 A,B utilizes a data set that is provided by a web application113A,B. The client application 105 A,B obtains the data set from the webapplication 113A,B by initiating a base client module 107A,B and callingmethods, procedures or similar functions of the base client module107A,B.

The base client module 107A,B is a program that facilitatescommunication between the client application 105A,B and the webapplications 113A,B by providing a client side mechanism for obtainingdata from the web applications 113A,B in a format that is easier toutilize than the standard web page format provided by the webapplication (i.e., hyper-text markup language (HTML) or extensiblehyper-text markup language (XHTML) formats). Further, the clientprogrammer or web application programmer can modify the base client, forexample by sub-classing a general base client class, to further processor format the data received from the web application to put it in acondition that is easy for the client application to utilize. This alsosimplifies the programming of the client application as it can utilizethe data modeling and structures that are most efficient for its corefunctional purposes. Each client application 105A,B can instantiate aseparate instance of a base client 107A,B. In addition, each thread orsimilar unit of execution for a client application 105A,B can initiate aseparate base client 107A,B.

In one embodiment, each base client 107A,B is tied to a specific webapplication 113A,B. The base client 107A,B is provided with the uniformresource locator (URL) that identifies the associated web application113A,B. The base client 107A,B can also be provided with a username andpassword for the web application 113A,B to enable authentication of asession between the respective base client 105A,B and web application113A,B. The base client 107A,B can also authenticate with the webapplication 113A,B through a session identifier or similar method. Inone example embodiment, the session identifier is a pseudo unique hashthat identifies a user or person for a given period of time. The sessionidentifier can be exchanged between the base client 107A,B and the webapplication 113A,B via a cookie or similar mechanism. Authentication cantake place at the message level, such as with username/passwordauthentication, which can be done for example through secure socketlayer (SSL)/transport layer security (TLS). Authentication can also takeplace at other levels such as SSL client-side certificateauthentication, which occurs during the connection handshake using SSLcertificates. Authentication could be handled by core logic 115, servermodules 117A,B or a specialized set of authentication modules. Anauthentication module would verify the identity of requesters before therequest reaches the server modules 117A,B or core logic 115.

The remote servers 103A,B can provide any number of web applications113A,B. The web applications 113A,B can include core logic 115 and aserver module 117A or similar components. The remote servers 103A,B canalso provide a separate data wrapper 109 or server module 117B. A remoteserver 103A,B can include any number of data wrapper 109, webapplications 113,A,B and server modules 117A,B.

The web application 113A,B can provide any type of functionality orservice. The core logic 115 is a component that carries out the primaryfunctions of the web application 113A,B. The functions can include anytype of calculation, database retrieval or similar function. In oneembodiment, the functions operate on local data structures anddatabases. In another embodiment, the functions operate on remote datastructures or databases or interfaces with other remote resources.Functions can include creation, deletion, editing and viewing of datafrom local and remote data structures and databases. Local and remotedatabases that can be resources managed by the functions include MySQL,SQLite, PostgreSQL and similar database systems.

The server modules 117A,B services all requests from browsers, clientapplications, base clients 107A,B and similar programs. In oneembodiment, the server module 117A exposes the functionality of the corelogic 115 to these programs. For example, base clients 107A,B can seekto create, delete, edit and view data from a database. The core logic115 fetches the data from the database, while the server modules 117A,Band or data wrapper 109 convert the database objects into a format to betransported to the requesting client 105A,B or base client 107A,B. Inanother embodiment, the server module 117B interacts with the exposedfunctionality of the core logic of the web application. The servermodules 117A,B offer methods, procedures or similar program hooks thatare called by or service the requests of the browsers, base clients107A,B or similar client applications. In one embodiment, a webapplication 113A,B can configure the types of requests it will service.The web application 113A,B can limit the access to a resource tobrowsers, base clients 107A,B or similar client applications. The webapplication 113A,B could also limit access to the resource to specificbrowsers, base clients 107A,B or similar client applications.

The server modules 117A,B determine the type of request and obtain therequisite information from the core logic 115. The type or datastructure that is returned by the server modules 117A,B is dependent onthe format requested by the browser, base client module 107A,B or clientapplication. In some scenarios, the server module 117A works inconjunction with a data wrapper 119 program to provide the data in therequisite format or type. The data wrapper 119 either converts the datathat is provided by or intercepted from the server module 117A into therequisite format or type before returning it to the base client 107A,B.

In another embodiment, the server module 117B is a separate applicationthat operates as an intermediary between the base client 107A,B and theweb application 113B. The server module 117B receives requests from abase client 107A,B. In some embodiments, the server module 117B handlesother types of requests including web browser requests with the sameexposed functionality. In other embodiments, the web application 117Bhandles the web browser requests and the server module 117B handles thebase client requests.

In one example implementation, the web applications 113A,B are FedoraServices by Red Hat, Inc. The Fedora Services can be implemented as partof the Fedora Services Framework. Specific Fedora Services can beimplemented using TurboGears by Kevin Dangoor or similar web applicationframework. The web applications 113A,B as well as the base client 107A,Band client applications 105A,B can be implemented using any softwaredevelopment environment, language, or platform.

FIG. 2 is a flowchart of one embodiment of a process for initializing abase client. The base client is initialized by a client application(block 201). The base client can be initialized at any point prior to arequest being generated by the client application. A single clientapplication can also initialize multiple base client modules. Separatebase clients can be initialized for each thread of execution, process orsimilar instance of a client application. In another embodiment, thebase client can service multiple processes, client applications orsimilar programs. In this embodiment, the base client is capable ofmanaging multiple client applications, processes, threads or similarprograms. The base client can be sub-classed from a general class orother sub-classes of the base client. Sub-classes can be written to addfunctionality including specific modifications to and processing of thedata returned from the web application to prepare it for use by theclient application.

During or after initialization, the client application provides the newbase client instance with identifying information for the webapplication to be accessed (block 203). The identifying information canbe in any format and provided as an parameter or input by a user via acommand line interface, graphical user interface or by hard coding. Inone embodiment, the identifying information is a uniform resourcelocator (URL). The client application can also provide authenticationinformation. The authentication information is information required toaccess or interact with a web application. The authenticationinformation can include a username and/or password. Similarly, this datacan also be provided by a user through either a command line interfaceor graphical user interface.

After the initialization, including the receipt of any authenticationinformation, is completed, the new base client instance is ready toreceive and service requests from the client application (block 205).The new base client instance can provide any type of feedback orresponse at completion of the initialization process to signal to theclient application that the base client module is ready to servicerequests or calls from the client application.

FIG. 3 is a diagram of one embodiment of a process for handling clientrequests by the base client. The process is initiated in response toreceiving a call or request from a client application (block 301). Therequest can be a persistent or non-persistent request. A persistentrequest remains open through out the duration of multiple individualdata requests. Use of persistent requests allows a base client toinitiate one request with a server that can be utilized through out thelifetime of the client program to make any number of data requestswithout having to initiate a new request. The user of non-persistentrequests minimizes the tracking of open requests and are handledindividually. The request can come in the form of a method call,procedure call or similar request. The base client can have any numberof methods, procedures or similar functions that are accessible to theclient application. A general class of the base client can include aminimum set of functions, while a sub-classed base client can have anexpanded set of functions. In one embodiment, the functions of the baseclient correlate with the functions of the web application. Thecorrelation could be a one to one correlation. In another embodiment,additional functions that process data from the web application to alterthe data into a form that is more useful to the client application canalso be defined.

In response to a data request from the client application, the baseclient establishes a session or checks for an established session withthe web application (block 303). The session data can be stored in anydata structure. In one embodiment, some session and related state datacan be stored in a cookie or similar format. If a session does not existor has ended then it is initiated or restarted. The initiation of thesession can include authentication wherein the authentication dataprovided by the client application data is provided to the webapplication to establish the session.

The accessed function of the base client can pre-process the requestdata and/or initiate a corresponding request with the web applicationthrough the session (block 305). Any type of pre-processing can bedefined. The pre-processing can include reformatting request data ordetermining parameters for a data request for the web application. Thefunctions of the base client can have any relationship to the functionsof the web application including a one to one (1:1), many to one (m:1),one to many (1:n) and/or many to many (m:n) correspondence.

The web application then processes the data request that is receivedfrom the base client in the form of a method call, procedure call orsimilar function call along with the parameters of such calls. The webapplication and/or any intermediate programs such as a data wrapper orsimilar program then provides a response to the data request (block307). The response data will be in a known format. In one exampleimplementation, the data is in the JavaScript Object Notation (JSON)format. Any type of standardized or well known data structure or formatcan be utilized. Responses can be streaming or non-streaming responses.If persistent requests are utilized, then the base client can open asingle connection. Instead of frequently polling the server for newdata, the client receives response data asynchronously as it is sent bythe server. Non-streaming responses are made to specific requests andrequire a new request to obtain a new response.

The base client can either return the received data to the clientapplication or further process the data (block 309). The base client canperform any type of processing on the data including reformatting thedata, aggregating the data, performing calculations using the data orperforming similar functions to prepare the data for use by the clientapplication. Sub-classing of the base client can be utilized toimplement specialized processing of the returned data for a clientapplication.

A check or validation of the returned data to ensure that it was notcorrupted in the transmission, corresponds to the client format or meetssimilar criteria can be performed (block 311). In some scenarios, theweb application or intermediate program does not return the requesteddata. Instead, an indicator of a type of error that occurred andprevented the servicing of the request is returned to the base client.If such an indicator is detected (block 313), then the indicator or acorresponding error indicator can be returned to the client application(block 315). In many cases the type of error generated at the webapplication cannot be returned to the client application, e.g.,exceptions cannot be passed in this way. Instead, an indicator of theexception is returned and the base client can translate this error intoa type understood by the client application or instantiate the error onthe client side such as with an exception to be serviced by the clientapplication or similar program.

If no error is detected, then the requested data is returned to theclient application (block 317). The entirety of the data can be returneddirectly to the client application or any sub-set thereof. In anotherembodiment, the data is not directly returned, rather it is madeaccessible to the client application. The reformatting or otherpost-processing of the data can be executed at this point instead ofupon receipt or separate aspects of the post-processing can be carriedout in each stage.

FIG. 4 is a diagram of one embodiment of a computer system for providingthe base client. Within the computer system 400 is a set of instructionsfor causing the machine to perform any one or more of the methodologiesdiscussed herein. In alternative embodiments, the machine can beconnected (e.g., networked) to other machines in a LAN, an intranet, anextranet or the Internet. The machine can operate in the capacity of aserver or a client machine (e.g., a client computer executing the baseclient module and the server computer executing the server module) in aclient-server network environment, or as a peer machine in apeer-to-peer (or distributed) network environment. The machine may be apersonal computer (PC), a tablet PC, a console device or set-top box(STB), a Personal Digital Assistant (PDA), a cellular telephone, a webappliance, a server, a network router, switch or bridge, or any machinecapable of executing a set of instructions (sequential or otherwise)that specify actions to be taken by that machine. Further, while only asingle machine is illustrated, the term “machine” shall also be taken toinclude any collection of machines (e.g., computers) that individuallyor jointly execute a set (or multiple sets) of instructions to performany one or more of the methodologies discussed herein.

The exemplary computer system 400 includes a processor 402, a mainmemory 404 (e.g., read-only memory (ROM), flash memory, dynamic randomaccess memory (DRAM) such as synchronous DRAM (SDRAM) or Rambus DRAM(RDRAM), etc.), a static memory 406 (e.g., flash memory, static randomaccess memory (SRAM), etc.), and a secondary memory 416 (e.g., a datastorage device in the form of a drive unit, which may include fixed orremovable computer-readable medium), which communicate with each othervia a bus 408.

Processor 402 represents one or more general-purpose processing devicessuch as a microprocessor, central processing unit, or the like. Moreparticularly, the processor 402 can be a complex instruction setcomputing (CISC) microprocessor, reduced instruction set computing(RISC) microprocessor, very long instruction word (VLIW) microprocessor,processor implementing other instruction sets, or processorsimplementing a combination of instruction sets. Processor 402 can alsobe one or more special-purpose processing devices such as an applicationspecific integrated circuit (ASIC), a field programmable gate array(FPGA), a digital signal processor (DSP), network processor, or thelike. Processor 402 is configured to execute the base client module 426for performing the operations and steps discussed herein.

The computer system 400 can further include a network interface device422. The computer system 400 also can include a video display unit 410(e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT))connected to the computer system through a graphics port and graphicschipset, an alphanumeric input device 412 (e.g., a keyboard), a cursorcontrol device 414 (e.g., a mouse), and a signal generation device 420(e.g., a speaker).

The secondary memory 416 can include a machine-readable storage medium(or more specifically a computer-readable storage medium) 424 on whichis stored one or more sets of instructions (e.g., the base client module426) embodying any one or more of the methodologies or functionsdescribed herein. The base client module 426 can also reside, completelyor at least partially, within the main memory 404 and/or within theprocessing device 402 during execution thereof by the computer system400, the main memory 404 and the processing device 402 also constitutingmachine-readable storage media. The base client module 426 can furtherbe transmitted or received over a network 418 via the network interfacedevice 422.

The machine-readable storage medium 424 can also be used to store thebase client module 426 persistently. While the machine-readable storagemedium 424 is shown in an exemplary embodiment to be a single medium,the term “machine-readable storage medium” and also “computer-readablemedium” should be taken to include a single medium or multiple media(e.g., a centralized or distributed database, and/or associated cachesand servers) that store the one or more sets of instructions. The terms“machine-readable storage medium” and “computer-readable medium” shallalso be taken to include any medium that is capable of storing orencoding a set of instructions for execution by the machine and thatcause the machine to perform any one or more of the methodologies of thepresent invention. The terms “machine-readable storage medium” and“computer-readable medium” shall accordingly be taken to include, butnot be limited to, solid-state memories, and optical and magnetic media.

In the above description, numerous details are set forth. It will beapparent, however, to one skilled in the art, that the present inventioncan be practiced without these specific details. In some instances,well-known structures and devices are shown in block diagram form,rather than in detail, in order to avoid obscuring the presentinvention.

Some portions of the detailed descriptions above are presented in termsof algorithms and symbolic representations of operations on data bitswithin a computer memory. These algorithmic descriptions andrepresentations are the means used by those skilled in the dataprocessing arts to most effectively convey the substance of their workto others skilled in the art. An algorithm is here, and generally,conceived to be a self-consistent sequence of steps leading to a desiredresult. The steps are those requiring physical manipulations of physicalquantities. Usually, though not necessarily, these quantities take theform of electrical or magnetic signals capable of being stored,transferred, combined, compared and otherwise manipulated. It has provenconvenient at times, principally for reasons of common usage, to referto these signals as bits, values, elements, symbols, characters, terms,numbers or the like.

It should be borne in mind, however, that all of these and similar termsare to be associated with the appropriate physical quantities and aremerely convenient labels applied to these quantities. Unlessspecifically stated otherwise as apparent from the above discussion, itis appreciated that throughout the description, discussions utilizingterms such as “processing,” “computing,” “generating,” “determining,”“selecting,” “displaying,” “receiving,” “updating,” “modifying,”“requesting,” “running,” “executing,” “checking,” “initiating,”“returning,” “retrieving,” “identifying,” “calculating,” “reformatting,”“outputting,” or the like, refer to the actions and processes of acomputer system, or similar electronic computing device that manipulatesand transforms data represented as physical (electronic) quantitieswithin the computer system's registers and memories into other datasimilarly represented as physical quantities within the computer systemmemories, registers or other such information storage, transmission ordisplay devices.

The present invention also relates to an apparatus for performing theoperations herein. This apparatus can be specially constructed for therequired purposes or it can comprise a general purpose computerselectively activated or reconfigured by a computer program stored inthe computer. Such a computer program can be stored in a computerreadable storage medium, such as, but not limited to, any type of diskincluding floppy disks, optical disks, CD-ROMs and magnetic-opticaldisks, read-only memories (ROMs), random access memories (RAMs), EPROMs,EEPROMs, magnetic or optical cards or any type of media suitable forstoring electronic instructions, each of which may be coupled to acomputer system bus.

The algorithms and displays presented herein are not inherently relatedto any particular computer or other apparatus. Various general purposesystems may be used with programs in accordance with the teachingsherein or it may prove convenient to construct more specializedapparatus to perform the required method steps. The required structurefor a variety of these systems will appear from the description below.In addition, the present invention is not described with reference toany particular programming language. It will be appreciated that avariety of programming languages may be used to implement the teachingsof the invention as described herein.

A computer readable medium includes any mechanism for storinginformation in a form readable by a computer. For example, a computerreadable medium includes read only memory (“ROM”), random access memory(“RAM”), magnetic disk storage media; optical storage media, flashmemory devices or other type of machine-accessible storage media.

Thus, a method and apparatus for facilitating client-server interfacinghas been described. It is to be understood that the above description isintended to be illustrative and not restrictive. Many other embodimentswill be apparent to those of skill in the art upon reading andunderstanding the above description. The scope of the invention should,therefore, be determined with reference to the appended claims, alongwith the full scope of equivalents to which such claims are entitled.

The invention claimed is:
 1. A method comprising: receiving a uniformresource locator identifying a web application by a base client modulefrom a client application during initialization of the base clientmodule by the client application, wherein the base client module is aninstance exclusive to client application and specific to the webapplication; receiving a first request from the client application on aclient computer after initialization for data in a first non-web pageformat from a web application on a remote server at the base clientmodule on the client computer; establishing cookies for a session withthe web application by the base client module; executing a function callby the base client module in response to the first request, the functioncall provided by a server module of the web application, wherein thefunction call is communicated directly to the server module within anapplication layer; receiving a response data to the function call in aJava Script Object Notation (JSON) format from the server module;reformatting the response data into the first non-web page format forthe client application by the base client module; and identifying anerror indicator in the response data.
 2. The method of claim 1, whereinthe first request is a call to a method of the base client module. 3.The method of claim 1, further comprising: initiating an error for theclient application in response to the error indicator.
 4. The method ofclaim 1, further comprising: receiving authentication data for the webapplication during initialization of the base client module.
 5. Themethod of claim 1, wherein the client application is implemented inPython.
 6. The method of claim 1, wherein the base client module is asub-class of a general class and provides additional processing of theresult data for the client application.
 7. A non-transitory computerreadable storage medium, having instructions stored therein, which whenexecuted, cause a computer to perform a set of operations comprising:receiving a uniform resource locator identifying a web application by abase client module from a client application during initialization ofthe base client module by the client application, wherein the baseclient module is an instance exclusive to the client application andspecific to the web application; receiving a first request from theclient application on a client computer after initialization for data ina first non-web page format from a web application on a remote server atthe base client module on a client computer; establishing cookies for asession with the web application by the base client module; executing afunction call by the base client module in response to the firstrequest, the function call provided by a server module of the webapplication, wherein the function call is communicated directly to theserver module within an application layer; receiving a response data tothe function call in a Java Script Object Notation (JSON) format fromthe server module; reformatting the response data into the first non-webpage format for the client application; and identifying an errorindicator in the response data.
 8. The non-transitory computer readablestorage medium of claim 7, wherein the first request is a call to amethod of the base client module.
 9. The non-transitory computerreadable storage medium of claim 7, having further instructions therein,which when executed, cause the computer to perform a further set ofoperations, further comprising: initiating an error for the clientapplication in response to the error indicator.
 10. The non-transitorycomputer readable storage medium of claim 7, having further instructionstherein, which when executed, cause the computer to perform a furtherset of operations, further comprising: receiving authentication data forthe web application during initialization of the base client module. 11.The non-transitory computer readable storage medium of claim 7, whereinthe client application is implemented in Python.
 12. A systemcomprising: a processor; a system memory coupled to the processor; and abase client module to provide an interface between a remote webapplication and a client application executed by the processor, theinterface to service data requests for the web application and to returnresponse data in a client application format, the client applicationformat being a non-web page format; the base client module receiving auniform resource locator identifying the web application from the clientapplication during initialization by the client application, wherein thebase client module generates a cookie to track a session with the remoteweb application; wherein the base client module is an instance exclusiveto the client application and specific to the web application, whereinservicing data requests comprises executing a function call by the baseclient module, the function call provided by a server module of the webapplication, wherein the function call is communicated directly to theserver module within an application layer, wherein the response data isin a Java Script Object Notation (JSON) format, and wherein the responsedata is reformatted from the JSON format into the client applicationformat by the base client module; and wherein the base client moduleidentifies an error in the response data.
 13. The system of claim 12,wherein the function call is a method of the server module.
 14. Thesystem of claim 12, wherein the network processor initializes the baseclient module that is a sub-class of a general class and providesadditional processing of the result data for the client application.